<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorator="admin/public/layout">

<head>
    <title>Elasticsearch整合</title>
</head>
<div  layout:fragment="content">
    <section class="content-header">
        <h1>
            Elasticsearch全文检索整合
        </h1>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="alert alert-info" role="alert">Elasticsearch的安装就配置参见https://www.elastic.co/products/elasticsearch 官网教程</div>

                <div class="box box-default">
                    <form th:object="${settingSearch}" role="form" name="addForm" method="POST" th:action="@{/admin/setting/search}">
                        <input type="hidden" name="id"   th:value="${GlobalSetting.search.id}">
                        <div class="box-body">
                            <div class="form-group">
                                <label>开启Elasticsearch全文检索</label>
                                <span class="text-muted">(开启前一定要确认Elasticsearch安装好并且已开启服务)</span>
                                <div class="radio">
                                    <label><input type="radio" name="esearchOpen" value="true" th:checked="${settingSearch.esearchOpen}" > 开启 </label>
                                    <label class="ml-20"><input type="radio" name="esearchOpen" value="false" th:checked="!${settingSearch.esearchOpen}" > 关闭 </label>
                                </div>
                            </div>

                            <div class="form-group">
                                <label>搜索框提示语</label>
                                <input type="text" class="form-control" name="placeholder" placeholder="输入关键词" th:value="${settingSearch.placeholder}"  />
                            </div>
                        </div>
                        <div class="box-footer">
                            <button type="submit" class="btn btn-primary">保存</button>
                        </div>
                    </form>

                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <div class="box box-default">
                    <div class="box-header">
                        <h3 class="box-title">Elasticsearch索引管理</h3>
                    </div>
                    <div class="box-body">
                        <div class="form-group">
                            <div class="col-xs-4">
                                <a href="{{ route('admin.xunSearch.rebuild') }}" class="btn btn-success btn-block">重建索引</a>
                            </div>
                            <div class="col-xs-4">
                                <a href="{{ route('admin.xunSearch.clear') }}" class="btn btn-warning btn-block">清除索引</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>